﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace APILocawebGatewayUI.Nucleo
{
    internal abstract class ControleHTML
    {
        protected string Nome { get; set; }

        protected string Valor { get; set; }

        public abstract String Renderizar();

        public ControleHTML()
        {

        }
        public ControleHTML(String nome, String valor)
        {
            this.Nome = nome;
            this.Valor = valor;
        }
    }

    internal class Formulario
    {

        private List<ControleHTML> controles;

        public void AddControl(ControleHTML control)
        {
            controles.Add(control);

        }
        public Formulario()
        {
            controles = new List<ControleHTML>();
        }

        public String Campos()
        {
            StringBuilder form = new StringBuilder();

            foreach (ControleHTML item in controles)
                form.Append(item.Renderizar());

            return form.ToString();

        }
    }

    internal class InputInvisivel : ControleHTML
    {

        public InputInvisivel()
            : base()
        {

        }
        public InputInvisivel(String nome, String valor)
            : base(nome, valor)
        {

        }
        public override String Renderizar()
        {
            return "<input type='hidden' name='" + Nome + "' id='" + Nome + "' value='" + Valor + "'></input>\n";

        }

    }
}